const Index = ({ table_name, database, tableRef, all }) =>{
	return  {
		modal:{
			title: all ? <span>数据库【<b className='c3'>{ database }</b>】所有表的外键列表</span> : <span>表【<b className='c3'>{ table_name }</b>】外键列表</span>,
			width: '60%',
			maxWidth:null,
			controls: 0
		},
		table: {
			api:all ? 'mysql/show_foreign_keys' : 'mysql/show_foreign_key',
			param: { table_name, database },
			isIndex: 1,
			paging:0,
			simple:1,
			minHeight:238,
			cols:[
				{ title: '外键名称', 			dataIndex: 'CONSTRAINT_NAME', 				width:100, render: t => <b className='ar f13 c1'>{t}</b> },
				{
					title: '从表',
					children: [
						// { title: '数据库', 			dataIndex: 'TABLE_SCHEMA', 				width:100, render: t => <b className='ar f13'>{t}</b> },
						{ title: '表名', 			dataIndex: 'TABLE_NAME', 				width:100, render: t => <b className='ar f13'>{t}</b> },
						{ title: '字段', 			dataIndex: 'COLUMN_NAME', 				width:100, render: t => <b className='ar f13 c3'>{t}</b> }
					]
				},
				{
					title: '主表',
					children: [
						// { title: '数据库', 			dataIndex: 'REFERENCED_TABLE_SCHEMA', 				width:100, render: t => <b className='ar f13'>{t}</b> },
						{ title: '表名', 			dataIndex: 'REFERENCED_TABLE_NAME', 				width:100, render: t => <b className='ar f13'>{t}</b> },
						{ title: '字段', 			dataIndex: 'REFERENCED_COLUMN_NAME', 				width:100, render: t => <b className='ar f13 c3'>{t}</b> }
					]
				},
			],
			controls 	: {
				width: 80,
				data:  ({ TABLE_NAME, CONSTRAINT_NAME }) => [
					{ label:'删除', mode:'delPop', abs:0, way:'put', msg:<span>是否删除【<b className='ar c3'>{CONSTRAINT_NAME}</b>】外键?</span>, r:1, api:'mysql/structure/del_foreign_key', 
						param:{ table_name:TABLE_NAME, database, constraint_name: CONSTRAINT_NAME},
						onOk : () => {
							window.$.ref(tableRef).tableRef().search({ scroll:0 })
						}
					},
				]
			}
		}
	}
}
export default Index